<?php
session_start();	
	
include "./public/common/config.php";
if($_POST){
//	print_r($_POST);
	$username = $_POST['username'];
	$password = md5($_POST['password']);
	$tel = $_POST['tel'];
	
	$sql = "insert into user(username,password,tel) values('{$username}','{$password}','{$tel}')";
	if(mysql_query($sql)){
		$_SESSION['home_userid'] = mysql_insert_id();
		$_SESSION['home_username'] = $username;exit;
		echo '<script>location="index.php"</script>';
	}
}else{
	echo 2;
//	exit;
}
?>
<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<meta name="renderer" content="webkit">
	<title>用户注册</title>
	<!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
	<script type="text/javascript" src="js/jquery-1.11.3.min.js" ></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<link rel="stylesheet" href="css/set.css" />
</head>
<body>

<!-- 导航条 -->
<div class="container">
	<div class="row userset">
		<div class="col-md-6 col-md-offset-3 cont">
			<div class="page-header">
				<h3>用户注册 <small>user set</small></h3>
			</div>
			<form role="form" action="userset.php" method="post">
				<div class="form-group">
					<label>登陆账号：</label>
					<input type="text" class="form-control" name="username" placeholder="xxx">
				</div>
				<div class="form-group">
					<label>登陆密码：</label>
					<input type="password" class="form-control" name="password" placeholder="xxx">
				</div>
				<div class="form-group">
					<label>确认密码：</label>
					<input type="password" class="form-control" name="repassword" placeholder="xxx">
				</div>
				<div class="form-group">
					<label>手机号码：</label>
					<input type="text" class="form-control" name="tel" placeholder="xxx">
				</div>
				<div class="row">
					<div class="col-md-3 col-md-offset-6">
						<a href="index.html" class="btn btn-default btn-block">返&nbsp;&nbsp;回</a>
					</div>
					<div class="col-md-3">
						<input type="submit" class="btn btn-primary btn-block" value="快速注册">
					</div>
				</div>
			</form>
			
		</div>
	</div>
</div>

</body>
</html>
